package chapter10;

import java.io.*;

/**
 * Java增强的try语句
 */
public class AutoCloseTest2 {
    public static void main(String[] args) throws IOException {
        final BufferedReader br = new BufferedReader(new FileReader("src/chapter10/AutoCloseTest2.java"));
        final PrintStream ps = new PrintStream(new FileOutputStream("a.txt"));
        //Java9的新语法，try包裹的资源要求使用final来修饰
        try(br; ps) {
            System.out.println(br.readLine());
            ps.println("庄生晓梦迷蝴蝶");
        }
    }
}
